﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Bootstrap.MVC.Utils;

namespace Bootstrap.MVC.Infrastructure.ClientEvent
{
    public class ClientEvent
    {
        public string EventName { get; private set; }

        public string Handler { get; private set; }

        public ClientEvent(string eventName, string handler)
        {
            Guard.IsNotNullOrEmpty(eventName, "eventName");
            Guard.IsNotNull(handler, "handler");

            EventName = eventName;
            Handler = cleanUpHandler(handler);
        }

        private string cleanUpHandler(string handler)
        {
            return handler.Replace("()", "").Replace(";", "");
        }
    }
}